package app.cn.com.school.activity

import android.content.ContentValues
import android.content.Context
import android.content.Intent
import android.os.Bundle
import app.cn.com.school.R
import app.cn.com.school.adapter.AddressAdapter
import app.cn.com.school.databinding.ActivityAddressBinding

/**
 * 地址列表
 * */
class AddressActivity : BaseActivity<ActivityAddressBinding>(), AddressAdapter.setOnClickLoction {
    override fun edit(posit: Int) {
    }

    override fun delete(position: Int) {
    }

    override fun chose(position: Int, isChecked: Boolean) {
    }

    override fun initBindingVar() {
    }

    override fun initTitle() {
        binding.titlebar.title.text = "收货地址管理"
        binding.titlebar.back.setOnClickListener { finish() }
    }

    lateinit var context: Context
    var adapter: AddressAdapter? = null
    var moreList = ArrayList<ContentValues>()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initBinding(R.layout.activity_address)
        context = this
        initView()
    }

    private fun initView() {

        if (adapter == null) {
            adapter = AddressAdapter(context, moreList, this)
            binding.addressList.adapter = adapter
        }
        binding.addAddress.setOnClickListener {
            //添加地址
            startActivity(Intent(context, AddListAddressActivity::class.java))
        }


    }
}
